import request from '@/utils/request';

// 查询账户余额
export function getAccountBalance() {
  return request({
    url: '/api/account/balance',
    method: 'get'
  });
}

// 充值
export function rechargeAccount(data) {
  return request({
    url: '/api/account/recharge',
    method: 'post',
    data
  });
}

// 提现
export function withdrawAccount(data) {
  return request({
    url: '/api/account/withdraw',
    method: 'post',
    data
  });
}

// 转账
export function transferAccount(data) {
  return request({
    url: '/api/account/transfer',
    method: 'post',
    data
  });
}

// 高级转账
export function advancedTransferAccount(data) {
  return request({
    url: '/api/account/advanced-transfer',
    method: 'post',
    data
  });
}

// 银行卡相关 API
// 获取银行卡列表
export function getBankCardList() {
  return request({
    url: '/api/bankcard/list',
    method: 'get'
  });
}

// 添加银行卡
export function addBankCard(data) {
  return request({
    url: '/api/bankcard/add',
    method: 'post',
    data
  });
}

// 获取银行卡详情
export function getBankCardDetail(id) {
  return request({
    url: `/api/bankcard/${id}`,
    method: 'get'
  });
}

// 设置默认银行卡
export function setDefaultBankCard(id) {
  return request({
    url: `/api/bankcard/default/${id}`,
    method: 'put'
  });
}

// 删除银行卡
export function deleteBankCard(id) {
  return request({
    url: `/api/bankcard/${id}`,
    method: 'delete'
  });
}

// 交易记录相关 API
// 获取交易记录列表
export function getTransactionList(params) {
  return request({
    url: '/api/transaction/list',
    method: 'get',
    params
  });
}

// 获取交易详情
export function getTransactionDetail(tradeNo) {
  return request({
    url: `/api/transaction/detail/${tradeNo}`,
    method: 'get'
  });
}
